import React, { Component } from 'react'
import {
  View,
  Image,
  Text
  // NativeAppEventEmitter,
} from 'react-native'

import StyleSheet from '../../utils/rzStyleSheet'
// import loadingIcon from '../../../assets/img/icon/loading.gif';
import errIcon from '../../../assets/images/icon/null4.png'
import RzLoading from './rzLoading'

// var subscription; //订阅者

const styles = StyleSheet.create({
  container: {
    position: 'absolute',
    top: 0,
    // ios: {
    //   top: 64
    // },
    // android: {
    //   top: 44
    // },
    left: 0,
    right: 0,
    bottom: 0,
    flexDirection: 'column',
    justifyContent: 'center',
    alignItems: 'center'
  },
  loading: {
    width: 100,
    top: -50
  },
  title: {
    top: -70,
    fontSize: 17,
    fontWeight: 'bold',
    color: '#333333'
  }
})

class BaseComponent extends Component {
  constructor (props) {
    super(props)
    this.displayName = 'BaseComponent'
    // this.renderLoading = this.renderLoading.bind(this)
    this.renderError = this.renderError.bind(this)
  }

  renderError () {
    return (
      <View style={styles.container}>
        <Image
          source={errIcon}
          style={styles.loading}
          resizeMode={'contain'}
        />
        <Text style={styles.title}>出错啦～</Text>
      </View>
    )
  }

  renderXeLoading () {
    return (
      <View style={[styles.container, { backgroundColor: 'transparent' }]}>
        <RzLoading
          loadingWH={20}
        />
      </View>
    )
  }
  render () {
    return null
  }
  }

export default BaseComponent
